﻿#region

using Microsoft.AspNetCore.Http;

#endregion

namespace Vin.Extension.Framework.Models;

public class VinHttpContextInfoModel
{
    /// <summary>
    /// 控制器地址
    /// </summary>
    public string? ControllerPath { get; set; }
    
    /// <summary>
    /// Action地址
    /// </summary>
    public string? ActionPath { get; set; }
    
    /// <summary>
    /// 请求地址
    /// </summary>
    public string? Url { get; set; }
    
    /// <summary>
    /// 请求方法
    /// </summary>
    public string? Method { get; set; }
    
    /// <summary>
    /// 请求参数
    /// </summary>
    public object? Params { get; set; }
    
    /// <summary>
    /// 请求体
    /// </summary>
    public object? Data { get; set; }
    
    /// <summary>
    /// 请求头
    /// </summary>
    public object? Header { get; set; }
    
    /// <summary>
    /// 请求curl
    /// </summary>
    public string? Curl { get; set; }
    
    /// <summary>
    /// 响应码
    /// </summary>
    public int? Code { get; set; }
    
    /// <summary>
    /// 响应体
    /// </summary>
    public object? Body { get; set; }
    
    /// <summary>
    /// 异常
    /// </summary>
    public string? Exception { get; set; }
    
    /// <summary>
    /// 请求ip
    /// </summary>
    public string? Ip { get; set; }
    
    /// <summary>
    /// 请求位置
    /// </summary>
    public string? Location { get; set; }
    
    /// <summary>
    /// 请求浏览器
    /// </summary>
    public string? Browser { get; set; }
    
    /// <summary>
    /// 请求操作系统
    /// </summary>
    public string? Os { get; set; }
    
    /// <summary>
    /// 请求代理
    /// </summary>
    public string? UserAgent { get; set; }

    /// <summary>
    /// 是否成功
    /// </summary>
    public bool IsSuccess => Code == StatusCodes.Status200OK;
    
    /// <summary>
    /// 是否异常
    /// </summary>
    public bool IsException => !string.IsNullOrEmpty(Exception);
}